<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div class="mainbar">
	<div class="page-head">
		<h2 class="pull-left">
			<i class="icon-table"></i>
			<spring:message code="menu.listProduct.label" />
		</h2>
		<div class="clearfix"></div>
	</div>
	<div class="matter">
		<div class="container-fluid">

			<!-- Table -->

			<div class="row-fluid">

				<div class="span12">

					<div class="widget">

						<div class="widget-head">
							<div class="pull-left">
								<spring:message code="menu.listProduct.label" />
							</div>
							<div class="pull-right">
								<a href="${pageContext.request.contextPath}/admin/getAddProduct"
									class="btn btn-mini btn-success"> <i class="icon-pencil"></i>
									<spring:message code="menu.addProduct.label" /></a>

							</div>
							<div class="clearfix"></div>
						</div>

						<div class="widget-content">

							<table id="adminTable"
								class="table table-striped table-bordered table-hover">

								<thead>
								   <tr>
                                            <th colspan="7">Category:   
                                            <select name="album" onchange="getListCate(this);" id="cateList">
                                                  	<c:forEach items="${cateList}" var="cate">
                                                  	<c:choose>
                                                  	<c:when test="${chooseCate.id == cate.id }">
                                                  		<option value="${cate.id}" selected>
															<c:out value="${cate.name}" />
														</option>
                                                  	</c:when>
                                                  	   <c:otherwise>
                                                                <option value="${cate.id}">${cate.name}</option>
                                                            </c:otherwise>
                                                  	</c:choose>
														
													</c:forEach>
                                                                                                 
                                                </select></th>
                                        </tr>
									<tr>
										<th style="width: 20px">#</th>
									
										<th style="min-width: 50px; max-width: 250px"><spring:message
												code="menu.productname.label" /></th>
										<th style="min-width: 30px; max-width: 250px"><spring:message
												code="menu.productprice.label" /></th>
										<th style="min-width: 50px; max-width: 250px"><spring:message
												code="menu.productdesc.label" /></th>
										<th style="min-width: 50px; max-width: 250px"><spring:message
												code="table.header.processdate" /></th>
										<th style="min-width: 50px; max-width: 250px"><spring:message
												code="table.header.user" /></th>
										<th><spring:message code="menu.isActive.label" /></th>
										<th style="width: 100px"><spring:message
												code="menu.control.label" /></th>

									</tr>
								</thead>

								<tbody>
									<c:forEach items="${productList}" var="product"
										varStatus="count">										
										<tr>
											<td>${count.count}</td>										
											<td><c:out value="${product.name}" /></td>
											<td><c:out value="${product.price}" /></td>
											<td><c:out value="${product.description}" /></td>
											<td><c:out value="${product.processDate}" /></td>
											<td><c:out value="${product.user}" /></td>
											<td><c:choose>
													<c:when test="${product.isActive == true}">
															<a id="showbutton${product.id}" style="width: 3px;"
															onclick="return confirmDeactive('Product', ${product.id});">Hiển
															Thị</a>
													</c:when>
													<c:otherwise>
														<a id="showbutton${product.id}" style="width: 3px;"
															onclick="return confirmDeactive('Product', ${product.id});">Không
															Hiển Thị</a>
													</c:otherwise>
												</c:choose></td>
											<td>
												<form action="getUpdateProduct" method="get" style="width:50px; float:left">
													<button type="submit" class="btn btn-mini btn-warning">
														<i class="icon-pencil"></i>
														<spring:message code="menu.edit.label" />
													</button>
													<input type="hidden" value="${product.id}" name="productId">
												</form>
<!-- 													<form action="deleteProduct" method="get"> -->
													<button  class="btn btn-mini  btn-danger" onclick="confirmDelete('Product', ${product.id})">
														<i class="icon-pencil"></i>
														<spring:message code="menu.delete.label" />
													</button>
<%-- 													<input type="hidden" value="${product.id}" name="productId"> --%>
<!-- 												</form> -->
											</td>
										</tr>
									</c:forEach>
								</tbody>

							</table>

						</div>
						<div class="widget-foot"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>